/*
 * spi.h
 *
 *  Created on: Sep 30, 2013
 *      Author: Ken Arok
 */

#ifndef SPI_H_
#define SPI_H_

#include "config_board.h"

#if BOARD_2_1_USED

#include "compiler.h"

/* Buffer size for receiving. */
#define MAX_DATA			50

typedef struct {
	uint8_t *pBuf;		//! Response data
	uint8_t	size_t;		//! Size of response data
}ado_respons_t;

/* Global Flag. */
extern volatile bool spi_message_is_received;
extern volatile bool spi_command_is_received;
extern volatile bool spi_rx_buffer_is_ready;

//! Protocol token.
extern volatile uint8_t ado_token[3];

//! Receive data buffer.
extern volatile uint8_t ado_data[MAX_DATA];

/** \brief Initialize SPI as Slave.
 *
 */
extern void spi_slave_init(void);


#endif /* BOARD_2_1_USED */

#endif /* SPI_H_ */
